import { ScriptRunner } from "@sapi-game/Runner/scriptRunner";
import { WereWolfChestLoader } from "@/werewolf/components/chestLoader";
import { WereWolfWolfPhase } from "@/werewolf/phases/wolf";
import { WereWolfPhaseView } from "@/werewolf/phaseView";
import { WereWolfRole } from "@/werewolf/player";

export class WolfClassicView extends WereWolfPhaseView<WereWolfWolfPhase> {
    override async runPhaseView(r: ScriptRunner): Promise<void> {
        await r.wait(40);
        this.players.title("§9§l预言家请闭眼");
        await r.wait(80);
        this.players.title("§4§l狼人开始行动");
        //加载箱子
        const chestLoader = this.state.getComponent(WereWolfChestLoader);
        chestLoader.loadWolfChest();
        //提示
        const wolves = this.players.filter(
            (p) => p.role == WereWolfRole.Werewolf
        );
        wolves.forEach((p) => {
            p.sendMessage(
                "§4本局所有狼人有:" + wolves.map((p) => p.name).join(",")
            );
        });
        this.state.startPhase();
    }
}
